// 领料出库主 API
import request from "@/utils/request";

// 领料出库主 VO 定义（JavaScript 对象形式）
export const PoStockOutMainVO = {
  // 主键ID
  id: 0,
  // 出库申请单
  mainNo: "",
  // 出库类型
  outType: "",
  // 仓库编码
  warehouseCode: "",
  // 仓库名称
  warehouseName: "",
  // 业务日期
  ywDate: null,
  // 领用人
  outStaff: "",
  // 领用部门
  outDept: "",
  // 合同号
  poContractCode: "",
  // 合同类型
  orderType: "",
  // 合同行号
  poContractDetailCode: "",
  // 供应商编码
  suppNo: "",
  // 供应商名称
  suppName: "",
  // 删除人
  deleter: "",
  // 删除时间
  deleteTime: null,
  // 业务状态
  busStatus: "",
  // 业务备注
  busMemo: "",
  // 预留字段
  reserveVarchar1: "",
  reserveVarchar2: "",
  reserveVarchar3: "",
  reserveVarchar4: "",
  reserveDecimal1: 0,
};

// 领料出库主 API
export const PoStockOutMainApi = {
  // 查询领料出库主分页
  getPoStockOutMainPage: function (params) {
    return request({
      method: "get",
      url: "/wm/po-stock-out-main/page",
      params: params,
    });
  },

  // 查询领料出库主详情
  getPoStockOutMain: function (id) {
    return request({
      method: "get",
      url: "/wm/po-stock-out-main/get?id=" + id,
    });
  },

  // 新增领料出库主
  createPoStockOutMain: function (data) {
    return request({
      method: "post",
      url: "/wm/po-stock-out-main/create",
      data: data,
    });
  },

  // 修改领料出库主
  updatePoStockOutMain: function (data) {
    return request({
      method: "put",
      url: "/wm/po-stock-out-main/update",
      data: data,
    });
  },

  // 删除领料出库主
  deletePoStockOutMain: function (id) {
    return request({
      method: "delete",
      url: "/wm/po-stock-out-main/delete?id=" + id,
    });
  },

  // 导出领料出库主 Excel
  exportPoStockOutMain: function (params) {
    return request({
      method: "get",
      url: "/wm/po-stock-out-main/export-excel",
      params: params,
      responseType: "blob",
    });
  },

  // ==================== 子表（采购出库） ====================

  // 获得采购出库分页
  getPoStockOutPage: function (params) {
    return request({
      method: "get",
      url: "/wm/po-stock-out-main/po-stock-out/page",
      params: params,
    });
  },

  // 新增采购出库
  createPoStockOut: function (data) {
    return request({
      method: "post",
      url: "/wm/po-stock-out-main/po-stock-out/create",
      data: data,
    });
  },

  // 修改采购出库
  updatePoStockOut: function (data) {
    return request({
      method: "put",
      url: "/wm/po-stock-out-main/po-stock-out/update",
      data: data,
    });
  },

  // 删除采购出库
  deletePoStockOut: function (id) {
    return request({
      method: "delete",
      url: "/wm/po-stock-out-main/po-stock-out/delete?id=" + id,
    });
  },

  // 获得采购出库
  getPoStockOut: function (id) {
    return request({
      method: "get",
      url: "/wm/po-stock-out-main/po-stock-out/get?id=" + id,
    });
  },
};

export default PoStockOutMainApi;